using CfgTable;
using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    /// <summary>
    /// 类名 : API - UI - 装备相关
    /// 作者 : Canyon / 龚阳辉
    /// 日期 : 2024-08-02 11:19
    /// 功能 : 
    /// </summary>
    public static class APIUIEquip
    {
        static public readonly int QualityStartValue = 3;
        static public readonly string[] AllQualitys = {
            "NR","SR","SSR"
        };
        static public readonly string[] DecomposeQuickSelectedTabs = {
            "NR","SR"
        };

        static public string GetSortName(int sort)
        {
            return (UIEquipSortType)sort switch
            {
                UIEquipSortType.Quality => "稀有度",
                UIEquipSortType.Star => "星级",
                UIEquipSortType.Lv => "等级",
                _ => "",
            };
        }

        static public string GetOrderName(int index)
        {
            return APIUIConst.GetOrderName(index);
        }

        static public string GetLocationName(int locationType)
        {
            return (UIEquipLocationType)locationType switch
            {
                UIEquipLocationType.Attack => "输出",
                UIEquipLocationType.Defense => "坦克",
                UIEquipLocationType.AddBlood => "治疗",
                _ => ""
            };
        }

        static public string GetInfoTabName(int tabType)
        {
            UIEquipInfoTabType eType = (UIEquipInfoTabType)tabType;
            return eType switch
            {
                UIEquipInfoTabType.Details => "详情",
                UIEquipInfoTabType.UpLv => "升级",
                UIEquipInfoTabType.UpStar => "升星",
                UIEquipInfoTabType.Reborn => "重生",
                _ => "",
            };
        }

        static public string GetUnlockDescNeedStar(int star)
        {
            return string.Format("解锁需要星级 : {0}", star);
        }

        /// <summary>
        /// 取得装备信息界面的页签对应的模块预制体资源路径
        /// </summary>
        static public string GetInfoNodePrefabAssetPath(int tab)
        {
            int cid = 100010 + tab;
            return APITableConfig.GetCfgResouceUrl(cid);
        }

        static public string GetNextExpStr(int exp, int expNext)
        {
            bool isMax = (expNext <= 0) || (exp >= expNext);
            if (isMax)
                return APIUIConst.GetMaxLabel();
            return $"{exp}/{expNext}";
        }

        /// <summary>
        /// 升级消耗的间隔长度
        /// </summary>
        static public int OneCostItemCount => APIUIConst.CostDefaultSpacing;

        /// <summary>
        /// 升级消耗(升级道具|单个道具提供经验)
        /// </summary>
        static public IReadOnlyList<int> UpLvCostItems => TableCenter.global.EquipUpLvCostItems;

        /// <summary>
        /// 消耗(道具ID（金币）|道具数量) / 1点经验
        /// </summary>
        static public IReadOnlyList<int> UpLvCostMoney => TableCenter.global.EquipUpLvCostMoney;

        static public readonly string FmtRebornEquipNameNum = "{0} * {1}";

        /// <summary>
        /// 锁定装备不能被分解
        /// </summary>
        static public readonly int NoticeCid_LockNotDecompose = 20040;

        /// <summary>
        /// 没有可分解的装备
        /// </summary>
        static public readonly int NoticeCid_NotHasEquip = 20041;

        static public string GetEquipSkinAddAttributeDesc(CfgAttribute cfg, string attrVal)
        {
            if (cfg == null)
                return "";
            return string.Format("{0} + {1}", cfg.Name, attrVal);
        }
    }
}
